package com.rd.student.jiaji.class4.suyan.zrrd.day30_0801;

import java.util.Arrays;
import java.util.Scanner;

public class arrTest {
    public static void main(String[] args) {
//        test();
        test1();
    }

    public static void test() {
        int[] arr = new int[]{1, 3, 5, 7, 9, 11, 13, 15, 17};
        System.out.println(Arrays.toString(arr));
//        for (int i=0;i<arr.length;i++){
//                System.out.println(Arrays.toString(arr));
//            }
        int[] arr1 = new int[]{10};
        int[] arr2 = new int[arr.length + arr1.length];
        System.arraycopy(arr, 0, arr2, 0, arr.length - 4);

        System.arraycopy(arr1, 0, arr2, arr.length - 4, arr1.length);
        System.arraycopy(arr, 5, arr2, 6, arr.length - 5);
        System.out.println(Arrays.toString(arr2));
    }

    public static void test1() {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入要删除的元素下标");
        int n=scanner.nextInt();
        int[] arr = new int[]{1, 3, 5, 7, 9, 11, 13, 15, 17};
        for (int i = n; i < arr.length-1; i++) {
            arr[i]=arr[i+1];
            }
        arr[arr.length-1]=0;
        System.out.println(Arrays.toString(arr));

        }


}


